package memory

import (
	"context"
	"mall_frontend_api/biz/model"
	"time"
)

func MGetCategory(ctx context.Context, ids ...int64) (map[int64]*model.Category, error) {
	return NewMemory[int64, *model.Category](ctx,
		WithCacheKey[int64, *model.Category](Category),
		WithMissDataFn[int64, *model.Category](func(ctx context.Context, ids []int64) (map[int64]*model.Category, error) {
			return dao.CategoryDAO.MGet(ctx, ids)
		}),
		WithCacheTTL[int64, *model.Category](5*time.Minute)).MGet(ids...)
}
